package main

import "fmt"

type Point struct {
	X, Y int
}

// 值变量的方式传递 结构体

func Scale(p Point, factor int) Point {
	return Point{X: p.X * factor, Y: p.Y * factor}
}

// 指针方式传递 结构体

func Bonus(p *Point, factor int) {
	p.X *= factor
	p.Y *= factor
}

func main() {
	p1 := Point{X: 10, Y: 20}
	fmt.Println(p1)

	p2 := Scale(p1, 2)
	fmt.Println(p2)

	p3 := Point{X: 10, Y: 20}
	Bonus(&p3, 2)
	fmt.Println(p3)

	p4 := &Point{X: 10, Y: 20}
	fmt.Println(p4)

	fmt.Println(p2.X == p3.X && p2.Y == p3.Y) // "false"
	fmt.Println(p2 == p3)                     // "false"

}
